package com.study.dubbo.service.config;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ProviderConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lin
 * @create 2018-07-30 16:36
 **/
@Configuration
public class DubboConfig {
    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("provider-test");
        return applicationConfig;
    }
//    @Bean
//    public TracingFilter tracingFilter(){
//        return new TracingFilter();
//    }
    @Bean
    public ProviderConfig providerConfig(){
        ProviderConfig providerConfig=new ProviderConfig();
        providerConfig.setPort(20881);
        providerConfig.setServer("netty4");
//        providerConfig.getFilter()
        providerConfig.setFilter("tracing");
//        providerConfig.setFilter("tracingFilter");
        return providerConfig;
    }

    @Bean
    public RegistryConfig registryConfig() {
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("zookeeper://192.168.120.128:2181");
        registryConfig.setClient("curator");
        return registryConfig;
    }
}
